package com.itheima.homework.Set接口;

import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class Demo1 {
    public static void main(String[] args) {
        Set<String> set=new HashSet<>();
        Collections.addAll(set,"刘备","关羽","张飞","刘备","张飞");
        System.out.println(set.size());
        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()){
            String name = iterator.next();
            System.out.println(name);
        }

        for (String s : set) {
            System.out.println(s);
        }
    }
}
